<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
  const arr = ['小米','小天','小明','小红','小狗']
  // arr.forEach((item,index) => {
  //   console.log('ok')
  //   if(item === '小明') {
  //     console.log(index)
  //   }
  // })

  arr.some((item,index) => {
    console.log('ok')
    if(item === '小明') {
      console.log(index)
      return true
    }
  })
</script>
</body>
</html>